ARG REPO=mcr.microsoft.com/dotnet/runtime

# Installer image
FROM arm32v7/buildpack-deps:jammy-curl AS installer

# Retrieve ASP.NET Core
RUN aspnetcore_version=8.0.10 \
    && curl -fSL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$aspnetcore_version/aspnetcore-runtime-$aspnetcore_version-linux-arm.tar.gz \
    && aspnetcore_sha512='fae8b6b270a4dc9218df99bb3cc10f0a52db9ed3630ba82056402154d27c238f76e44561f85348cf1a4f7e2bd1dbd910d4138a91ef66abe5685d9972b3d050aa' \
    && echo "$aspnetcore_sha512  aspnetcore.tar.gz" | sha512sum -c - \
    && mkdir -p /dotnet \
    && tar -oxzf aspnetcore.tar.gz -C /dotnet ./shared/Microsoft.AspNetCore.App \
    && rm aspnetcore.tar.gz


# ASP.NET Core image
FROM $REPO:8.0.10-jammy-chiseled-extra-arm32v7

# ASP.NET Core version
ENV ASPNET_VERSION=8.0.10

COPY --from=installer ["/dotnet", "/usr/share/dotnet"]
